/*
 * Copyright (c) 2024 Huawei Technologies Co., Ltd.
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
 * CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */
#include <cmath>
#include "tiling_91093.h"
#include "tiling_func.h"
namespace Lcal {
    constexpr int32_t ALLGATHER_91093_EIGHT_RANK_FP16_COMMDATASPLIT_DEFAULT = 16;
    constexpr int32_t ALLGATHER_91093_EIGHT_RANK_FP16_PVALUE_DEFAULT = 12;
    constexpr int32_t ALLGATHER_91093_EIGHT_RANK_FP16_UBMOVENUM_DEFAULT = 8;
    constexpr int32_t ALLGATHER_91093_EIGHT_RANK_FP16_M0_DEFAULT = 128;
    constexpr int32_t ALLGATHER_91093_SIXTEEN_RANK_FP16_UBMOVENUM_DEFAULT = 30;
    constexpr int32_t ALLGATHER_91093_SIXTEEN_RANK_FP16_COMMDATASPLIT_DEFAULT = 16;
    constexpr int32_t ALLGATHER_91093_SIXTEEN_RANK_FP16_COMMDIRECT_DEFAULT = 1;
    constexpr int32_t ALLGATHER_91093_SIXTEEN_RANK_FP16_PVALUE_DEFAULT = 10;
    constexpr int32_t ALLGATHER_91093_SIXTEEN_RANK_FP16_M0_DEFAULT = 128;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_FP16_PVALUE_DEFAULT = 14;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_FP16_UBMOVENUM_DEFAULT = 20;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_FP16_M0_DEFAULT = 128;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_FP16_COMMDATASPLIT_DEFAULT = 16;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_INT8_M0_DEFAULT = 128;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_INT8_PVALUE_DEFAULT = 14;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_INT8_UBMOVENUM_DEFAULT = 40;
    constexpr int32_t ALLGATHER_91093_TWO_RANK_INT8_COMMDATASPLIT_DEFAULT = 16;

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093EightRankFP16M0Map = {
        {128,
         {{-1, 1262, -1, 2147483647, -1, 1720}, {-1, 1262, -1, 2147483647, 1824, 3248},
          {1262, 2147483647, -1, 2147483647, -1, 3248}, {-1, 2274, -1, 6700, 3248, 5660},
          {-1, 2274, 6700, 2147483647, 3248, 6172}, {2274, 2147483647, -1, 2147483647, 3248, 5360},
          {-1, 2147483647, -1, 2147483647, 6934, 8446}, {-1, 2147483647, 9950, 2147483647, 8446, 8958},
          {-1, 2147483647, -1, 2147483647, 8958, 2147483647}}},
        {256,
         {{-1, 1262, -1, 2147483647, 1720, 1824}, {-1, 2274, -1, 6700, 5660, 6934},
          {-1, 2274, 6700, 2147483647, 6172, 6934}, {2274, 2147483647, -1, 2147483647, 5360, 6934},
          {-1, 2147483647, -1, 9950, 8446, 8958}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093EightRankFP16UbmovenumMap = {
        {8,
         {{-1, 1768, -1, 2147483647, -1, 1624}, {-1, 1768, 1774, 2147483647, 1624, 2274},
          {1768, 2147483647, -1, 4810, -1, 1200}, {1768, 2147483647, 4810, 2147483647, -1, 2274}}},
        {4,
         {{-1, 1768, -1, 1774, 1624, 2274}}},
        {2,
         {{1768, 2147483647, -1, 4810, 1200, 2274}, {-1, 768, 768, 2147483647, 2274, 4608},
          {-1, 768, -1, 2147483647, 4608, 2147483647}, {768, 2147483647, -1, 2147483647, 2274, 2147483647}}},
        {3,
         {{-1, 768, -1, 768, 2274, 4608}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093EightRankFP16PvalueMap = {
        {2,
         {{-1, 2786, -1, 4608, -1, 1200}, {-1, 2786, -1, 8192, 1518, 1624},
          {768, 1262, -1, 2147483647, 1624, 1720}, {1262, 2786, 768, 2147483647, 1624, 2274},
          {2786, 2147483647, 4810, 9728, -1, 768}, {7168, 2147483647, 9728, 2147483647, -1, 768},
          {2786, 2147483647, 10720, 2147483647, 768, 1774}, {2786, 2147483647, 4810, 2147483647, 1774, 2274},
          {768, 1262, -1, 2147483647, 2274, 2912}, {1262, 2147483647, -1, 2147483647, 2274, 3248},
          {1262, 2147483647, -1, 2147483647, 3840, 4298}, {-1, 2147483647, -1, 2274, 4298, 5660},
          {1774, 2147483647, -1, 2274, 6684, 8958}}},
        {1,
         {{-1, 2786, 4608, 2147483647, -1, 1200}, {-1, 2786, -1, 2147483647, 1200, 1518},
          {-1, 2786, 8192, 2147483647, 1518, 1624}, {-1, 768, -1, 2147483647, 1624, 2274},
          {768, 1262, -1, 2147483647, 1720, 2274}, {2786, 7168, 9728, 2147483647, -1, 768},
          {-1, 768, -1, 2147483647, 2274, 4298}, {768, 1262, -1, 2147483647, 2912, 4298},
          {1262, 2147483647, -1, 2147483647, 3248, 3840}, {-1, 2147483647, -1, 2274, 5660, 6684},
          {-1, 1774, -1, 2274, 6684, 8958}, {-1, 2147483647, 2274, 9728, 4298, 8958},
          {-1, 2147483647, 9728, 2147483647, 4298, 6934}, {-1, 768, -1, 2147483647, 8958, 11744},
          {768, 1262, -1, 8704, 8958, 11744}, {1262, 2147483647, -1, 8446, 10720, 11744}}},
        {4,
         {{1262, 2786, -1, 768, 1624, 2274}, {2786, 2147483647, 1262, 4810, 768, 1774},
          {2786, 4608, -1, 4810, 1774, 2274}, {2786, 2147483647, 4810, 10720, 768, 1774},
          {-1, 2147483647, 9728, 2147483647, 6934, 8958}, {768, 1262, 8704, 2147483647, 8958, 11744},
          {1262, 2147483647, 8446, 2147483647, 8958, 11744}, {-1, 2000, -1, 2147483647, 11744, 2147483647},
          {2000, 2147483647, 8200, 2147483647, 11744, 2147483647}}},
        {12,
         {{2786, 2147483647, -1, 1262, -1, 768}}},
        {6,
         {{2786, 2147483647, 1262, 4810, -1, 768}, {4608, 2147483647, 768, 4810, 1774, 2274},
          {1262, 2147483647, -1, 8446, 8958, 10720}, {2000, 2147483647, -1, 8200, 11744, 2147483647}}},
        {10,
         {{2786, 2147483647, -1, 1262, 768, 1774}, {4608, 2147483647, -1, 768, 1774, 2274}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093EightRankFP16CommdatasplitMap = {
        {8,
         {{-1, 1768, -1, 2147483647, -1, 832}, {1262, 1768, -1, 768, 832, 1624},
          {-1, 1768, 768, 2147483647, 832, 1624}, {-1, 1768, 1774, 4608, 1880, 2274},
          {-1, 1768, 4608, 2147483647, 1624, 2274}, {1768, 8958, -1, 4810, -1, 1200},
          {8958, 2147483647, -1, 4810, -1, 1536}, {1768, 2147483647, 4810, 2147483647, -1, 2274},
          {8100, 8600, 9728, 2147483647, 4636, 2147483647}}},
        {16,
         {{-1, 1262, -1, 768, 832, 1624}, {-1, 1768, -1, 1774, 1624, 2274},
          {-1, 1768, 1774, 4608, 1624, 1880}, {1768, 8958, -1, 4810, 1200, 2274},
          {8958, 2147483647, -1, 4810, 1536, 2274}, {-1, 8100, -1, 2147483647, 2274, 2147483647},
          {8100, 8600, -1, 9728, 2274, 2147483647}, {8100, 8600, 9728, 2147483647, 2274, 4636},
          {8600, 2147483647, -1, 2147483647, 2274, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093SixteenRankFP16M0Map = {
        {128,
         {{-1, 2274, -1, 2147483647, -1, 5552}, {2274, 2786, 8200, 2147483647, -1, 4000},
          {2274, 2786, 5100, 2147483647, 4000, 5552}, {2786, 2147483647, -1, 5360, -1, 5552},
          {2786, 2147483647, 5900, 2147483647, -1, 5552}, {-1, 2147483647, 5360, 2147483647, 5552, 6172},
          {-1, 8958, 5360, 2147483647, 6172, 6934}, {-1, 2147483647, -1, 2147483647, 6934, 2147483647}}},
        {256,
         {{2274, 2786, -1, 8200, -1, 4000}, {2274, 2786, -1, 5100, 4000, 5552},
          {2786, 2147483647, 5360, 5900, -1, 5552}, {-1, 2147483647, -1, 5360, 5552, 6934},
          {8958, 2147483647, 5360, 2147483647, 6172, 6934}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093SixteenRankFP16PvalueMap = {
        {10,
         {{-1, 3798, -1, 1774, -1, 576}, {3798, 9728, -1, 1262, -1, 2274},
          {3798, 2147483647, 1262, 2274, -1, 768}}},
        {6,
         {{-1, 3798, 1774, 4608, -1, 576}, {9728, 2147483647, -1, 1262, -1, 2274}}},
        {1,
         {{-1, 3798, 4608, 7696, -1, 576}, {-1, 3798, -1, 2147483647, 576, 832},
          {-1, 2560, -1, 2147483647, 832, 1200}, {-1, 2786, 1774, 2147483647, 1200, 2274},
          {2786, 3798, 4298, 2147483647, 1200, 2274}, {-1, 3798, -1, 2147483647, 2274, 3248},
          {3798, 5900, -1, 2147483647, 2274, 2786}, {3798, 5900, 4608, 2147483647, 2786, 3248},
          {5900, 2147483647, 5360, 2147483647, 2274, 3248}, {-1, 2560, -1, 768, 3248, 8704},
          {-1, 7850, -1, 768, 8704, 2147483647}, {-1, 2147483647, 768, 2147483647, 3248, 11744},
          {-1, 1262, 768, 2147483647, 11744, 2147483647}, {2000, 2147483647, 6150, 2147483647, 11744, 2147483647}}},
        {2,
         {{-1, 3798, 7696, 2147483647, -1, 576}, {2560, 3798, -1, 2147483647, 832, 1200},
          {-1, 2286, -1, 768, 1200, 2274}, {-1, 3798, 768, 1774, 1200, 2274},
          {2786, 3798, 1774, 4298, 1200, 2274}, {3798, 6700, 4810, 5360, -1, 2274},
          {3798, 8100, 5360, 2147483647, -1, 2274}, {8100, 2147483647, 4810, 6450, 768, 2274},
          {8100, 2147483647, 6450, 2147483647, -1, 2274}, {3798, 5900, -1, 4608, 2786, 3248},
          {5900, 2147483647, 2274, 5360, 2274, 3248}, {2560, 2147483647, -1, 768, 3248, 8704},
          {7850, 2147483647, -1, 768, 8704, 2147483647}, {1262, 2000, 768, 2147483647, 11744, 2147483647}}},
        {4,
         {{2286, 3798, -1, 768, 1200, 2274}, {3798, 2147483647, 1262, 2274, 768, 2274},
          {3798, 2147483647, 2274, 4810, -1, 2274}, {6700, 8100, 4810, 5360, -1, 2274},
          {8100, 2147483647, 4810, 6450, -1, 768}, {5900, 2147483647, -1, 2274, 2274, 3248},
          {2000, 2147483647, 768, 6150, 11744, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093SixteenRankFP16CommdirectMap = {
        {0,
         {{-1, 2147483647, -1, 2147483647, -1, 1200}, {768, 8958, -1, 2147483647, 1200, 1438},
          {-1, 8958, -1, 2147483647, 1438, 2147483647}, {8958, 2147483647, -1, 2147483647, 1200, 2147483647}}},
        {1,
         {{-1, 768, -1, 2147483647, 1200, 1438}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093SixteenRankFP16CommdatasplitMap = {
        {16,
         {{-1, 1262, -1, 2147483647, -1, 1624}, {-1, 1262, -1, 2147483647, 1720, 2626},
          {1262, 2147483647, -1, 2147483647, -1, 2626}, {-1, 768, -1, 3798, 2626, 2147483647},
          {2274, 2147483647, -1, 3798, 2626, 3798}}},
        {1,
         {{-1, 1262, -1, 2147483647, 1624, 1720}, {768, 2274, -1, 3798, 2626, 2147483647},
          {2274, 2147483647, -1, 3798, 3798, 2147483647}, {-1, 2147483647, 3798, 2147483647, 2626, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093SixteenRankFP16UbmovenumMap = {
        {20,
         {{-1, 3286, -1, 2147483647, -1, 832}, {-1, 3286, -1, 1262, 832, 2274},
          {-1, 3286, 1774, 2147483647, 832, 2274}, {-1, 3286, -1, 2147483647, 2274, 3248},
          {3286, 3798, -1, 2147483647, -1, 2000}, {3286, 3798, 6150, 2147483647, 2000, 3248},
          {3798, 2147483647, -1, 5360, -1, 2274}, {3798, 2147483647, 5360, 5900, -1, 2000},
          {3798, 2147483647, 5900, 2147483647, -1, 3248}, {-1, 1262, -1, 2147483647, 3542, 4298},
          {-1, 1518, 768, 2147483647, 4298, 6172}, {-1, 768, -1, 2147483647, 6172, 8704},
          {-1, 768, -1, 6656, 8704, 2147483647}}},
        {30,
         {{-1, 3286, 1262, 1774, 832, 2274}}},
        {10,
         {{3286, 3798, -1, 6150, 2000, 3248}, {3798, 2147483647, -1, 5360, 2274, 3248},
          {3798, 2147483647, 5360, 5900, 2000, 3248}, {-1, 3000, -1, 7200, 3248, 3542},
          {-1, 2147483647, 7200, 2147483647, 3248, 3542}, {1262, 2024, -1, 2147483647, 3542, 4298},
          {-1, 1006, -1, 768, 4298, 6172}, {-1, 768, 6656, 2147483647, 8704, 2147483647},
          {768, 1774, -1, 11264, 6172, 6684}}},
        {8,
         {{3000, 2147483647, -1, 7200, 3248, 3542}, {2024, 2147483647, -1, 2147483647, 3542, 4298},
          {1006, 3584, -1, 768, 4298, 6172}, {768, 1774, -1, 11264, 6684, 2147483647}}},
        {6,
         {{3584, 2147483647, -1, 768, 4298, 6172}, {1518, 2147483647, 768, 2147483647, 4298, 6172},
          {768, 1774, 11264, 2147483647, 6172, 2147483647}}},
        {4,
         {{1774, 2274, -1, 2560, 6172, 2147483647}, {2274, 3286, -1, 2147483647, 6172, 8958},
          {3286, 2147483647, -1, 2147483647, 6172, 8446}}},
        {3,
         {{1774, 2274, 2560, 2147483647, 6172, 2147483647}, {2274, 3286, -1, 2147483647, 8958, 2147483647},
          {3286, 2147483647, -1, 2147483647, 8446, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankFP16CommdatasplitMap = {
        {8,
         {{-1, 1536, -1, 3584, -1, 1536}, {1536, 2560, -1, 8704, -1, 1536},
          {1536, 9728, 8704, 9728, -1, 1536}, {3584, 9728, 9728, 2147483647, -1, 1536},
          {9728, 2147483647, 768, 2560, -1, 1536}, {9728, 2147483647, 5120, 2147483647, -1, 1536}}},
        {16,
         {{-1, 1536, 3584, 8704, -1, 1536}, {2560, 9728, -1, 8704, -1, 1536},
          {-1, 1536, 8704, 9728, -1, 1536}, {-1, 3584, 9728, 2147483647, -1, 1536},
          {9728, 2147483647, -1, 768, -1, 1536}, {9728, 2147483647, 2560, 5120, -1, 1536},
          {-1, 2147483647, -1, 2147483647, 1536, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankFP16M0Map = {
        {128,
         {{-1, 4608, -1, 1280, -1, 1536}, {-1, 2560, 1280, 2147483647, -1, 1536},
          {2560, 4608, 5632, 2147483647, -1, 1536}, {4608, 5632, 7680, 2147483647, -1, 1536},
          {9728, 2147483647, 8192, 2147483647, -1, 1536}, {-1, 1536, -1, 3584, 1536, 2147483647},
          {1536, 2147483647, -1, 4608, 1536, 2147483647}, {-1, 2147483647, 4608, 2147483647, 1536, 7680},
          {3584, 2147483647, 4608, 2147483647, 7680, 2147483647}}},
        {256,
         {{2560, 4608, 1280, 5632, -1, 1536}, {4608, 5632, -1, 7680, -1, 1536},
          {5632, 9728, -1, 2147483647, -1, 1536}, {9728, 2147483647, -1, 8192, -1, 1536},
          {-1, 1536, 3584, 4608, 1536, 2147483647}, {-1, 3584, 4608, 2147483647, 7680, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankFP16UbmovenumMap = {
        {10,
         {{-1, 4608, -1, 1792, -1, 1536}}},
        {20,
         {{-1, 4608, 1792, 2560, -1, 1536}}},
        {6,
         {{-1, 4608, 2560, 2147483647, -1, 1536}, {4608, 2147483647, -1, 8704, -1, 1536},
          {5632, 2147483647, -1, 8704, 1536, 2560}, {4608, 2147483647, 8704, 2147483647, 1536, 3584}}},
        {4,
         {{-1, 3584, -1, 6656, 1536, 2560}, {1536, 4608, 8704, 2147483647, 2560, 3584},
          {4608, 5632, -1, 8704, 1536, 2560}, {4608, 7680, 5632, 8704, 2560, 4608},
          {7680, 2147483647, -1, 8704, 2560, 4608}, {4608, 2147483647, 8704, 9728, 3584, 4608}}},
        {3,
         {{3584, 4608, -1, 6656, 1536, 2560}, {-1, 4608, 6656, 2147483647, 1536, 2560},
          {-1, 1536, -1, 4608, 2560, 3584}, {-1, 1536, -1, 1536, 3584, 4608},
          {1536, 4608, 5632, 2147483647, 3584, 4608}, {4608, 7680, -1, 5632, 2560, 4608},
          {4608, 2147483647, 9728, 2147483647, 3584, 4608}, {-1, 1536, 9728, 2147483647, 19456, 2147483647},
          {1536, 3584, 6656, 2147483647, 4608, 5632}, {5632, 2147483647, 3584, 2147483647, 4608, 5632}}},
        {2,
         {{-1, 1536, 4608, 2147483647, 2560, 3584}, {1536, 4608, -1, 8704, 2560, 3584},
          {-1, 1536, 1536, 2147483647, 3584, 4608}, {1536, 4608, -1, 5632, 3584, 4608},
          {-1, 1536, -1, 2147483647, 4608, 15360}, {-1, 1536, -1, 9728, 15360, 2147483647},
          {-1, 1536, 9728, 2147483647, 15360, 19456}, {1536, 3584, -1, 6656, 4608, 5632},
          {1536, 3584, -1, 2147483647, 5632, 2147483647}, {3584, 5632, -1, 2147483647, 4608, 2147483647},
          {5632, 2147483647, -1, 3584, 4608, 5632}, {5632, 2147483647, -1, 2147483647, 5632, 2147483647}}},
        {16,
         {{4608, 2147483647, 8704, 2147483647, -1, 1536}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankFP16PvalueMap = {
        {10,
         {{-1, 2560, -1, 5632, -1, 1536}, {1536, 2560, -1, 2147483647, 1536, 2560},
          {-1, 2560, -1, 7680, 2560, 3584}, {3584, 7680, -1, 3584, -1, 1536},
          {1536, 2560, -1, 2147483647, 11264, 13312}, {2560, 3584, 9728, 2147483647, 9728, 11264},
          {2560, 3584, 8704, 2147483647, 17408, 2147483647}}},
        {4,
         {{-1, 2560, 5632, 2147483647, -1, 1536}, {1536, 2560, 8704, 2147483647, 3584, 4608}}},
        {6,
         {{-1, 1536, -1, 2147483647, 1536, 2560}, {-1, 1536, -1, 2147483647, 3584, 4608},
          {-1, 1536, 6656, 2147483647, 4608, 9728}, {1536, 2560, -1, 2147483647, 9728, 11264},
          {2560, 3584, 1792, 8704, 9728, 15360}}},
        {12,
         {{-1, 2560, 7680, 2147483647, 2560, 3584}, {2560, 3584, -1, 3584, -1, 1536},
          {2560, 2147483647, 3584, 5632, 4608, 9728}, {3584, 2147483647, 6656, 2147483647, -1, 9728},
          {-1, 1536, 6656, 2147483647, 9728, 11264}, {2560, 3584, -1, 2560, 15360, 2147483647},
          {2560, 3584, 8704, 9728, 9728, 11264}, {3584, 8704, 3584, 2147483647, 9728, 11264},
          {3584, 7680, -1, 2147483647, 11264, 13312}, {3584, 4608, -1, 2147483647, 13312, 2147483647},
          {4608, 8704, -1, 8704, 13312, 2147483647}, {8704, 9728, -1, 1792, 9728, 2147483647},
          {8704, 9728, 2560, 2147483647, 9728, 2147483647}, {9728, 2147483647, 1280, 2147483647, 9728, 2147483647}}},
        {14,
         {{1536, 2560, -1, 8704, 3584, 4608}, {-1, 1536, -1, 6656, 4608, 9728},
          {1536, 2560, -1, 5632, 4608, 9728}, {7680, 2147483647, -1, 3584, -1, 1536},
          {2560, 2147483647, -1, 3584, 1536, 9728}, {2560, 2147483647, 3584, 5632, -1, 4608},
          {2560, 3584, 5632, 8704, -1, 9728}, {-1, 1536, -1, 6656, 9728, 11264},
          {-1, 1536, -1, 2147483647, 11264, 2147483647}, {1536, 2560, -1, 2147483647, 13312, 2147483647},
          {2560, 3584, -1, 1792, 9728, 15360}, {2560, 3584, 2560, 8704, 15360, 2147483647},
          {3584, 8704, -1, 3584, 9728, 11264}, {7680, 8704, -1, 2147483647, 11264, 13312},
          {4608, 8704, 8704, 2147483647, 13312, 2147483647}, {8704, 9728, 1792, 2560, 9728, 2147483647},
          {9728, 2147483647, -1, 1280, 9728, 2147483647}}},
        {3,
         {{1536, 2560, 5632, 2147483647, 4608, 9728}, {2560, 3584, 8704, 2147483647, -1, 9728}}},
        {8,
         {{3584, 2147483647, 5632, 6656, -1, 9728}, {2560, 3584, 8704, 2147483647, 11264, 17408}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankINT8CommdatasplitMap = {
        {8,
         {{-1, 1536, -1, 4608, -1, 1536}, {-1, 1536, -1, 3584, 1536, 15360},
          {-1, 1536, 3584, 4608, 1536, 6656}, {1536, 3584, 1280, 1792, -1, 7680},
          {-1, 1536, -1, 1280, 15360, 17408}, {-1, 1536, 8192, 9728, 15360, 17408},
          {-1, 1536, -1, 2048, 17408, 2147483647}, {-1, 1536, 4608, 5632, 17408, 2147483647}}},
        {16,
         {{-1, 1536, 4608, 2147483647, -1, 1536}, {-1, 1536, 3584, 4608, 6656, 15360},
          {-1, 1536, 4608, 2147483647, 1536, 15360}, {1536, 2147483647, -1, 1280, -1, 15360},
          {3584, 2147483647, 1280, 1792, -1, 7680}, {1536, 2147483647, 1280, 1792, 7680, 15360},
          {1536, 2147483647, 1792, 2147483647, -1, 15360}, {-1, 1536, 1280, 8192, 15360, 17408},
          {-1, 1536, 9728, 2147483647, 15360, 17408}, {-1, 1536, 2048, 4608, 17408, 2147483647},
          {-1, 1536, 5632, 2147483647, 17408, 2147483647}, {1536, 2147483647, -1, 2147483647, 15360, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankINT8UbmovenumMap = {
        {30,
         {{-1, 1536, -1, 4608, -1, 1536}}},
        {10,
         {{-1, 1536, 4608, 2147483647, -1, 5632}, {6656, 2147483647, -1, 768, -1, 4608},
          {1536, 2147483647, 768, 2147483647, -1, 5632}, {-1, 8704, -1, 2147483647, 5632, 9728},
          {-1, 5632, -1, 2147483647, 9728, 11264}, {-1, 6656, 768, 2147483647, 11264, 13312},
          {9728, 2147483647, -1, 2147483647, 11264, 13312}}},
        {40,
         {{-1, 1536, -1, 768, 1536, 5632}, {1536, 6656, -1, 768, -1, 1536}}},
        {20,
         {{-1, 1536, 768, 4608, 1536, 5632}, {-1, 6656, -1, 768, 11264, 13312}}},
        {12,
         {{1536, 6656, -1, 768, 1536, 5632}, {6656, 2147483647, -1, 768, 4608, 5632},
          {8704, 2147483647, -1, 2147483647, 5632, 9728}, {5632, 2147483647, -1, 2147483647, 9728, 11264},
          {-1, 6656, -1, 2147483647, 13312, 2147483647}, {6656, 9728, -1, 6656, 11264, 2147483647}}},
        {16,
         {{6656, 9728, 6656, 2147483647, 11264, 2147483647}, {9728, 2147483647, -1, 2147483647, 13312, 2147483647}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankINT8PvalueMap = {
        {6,
         {{-1, 1536, -1, 4608, -1, 1536}, {1536, 9728, -1, 768, 2560, 13312},
          {9728, 2147483647, -1, 1280, 6656, 13312}, {8704, 9728, 1792, 2560, 13312, 2147483647},
          {9728, 2147483647, 2560, 7680, 2560, 5632}, {9728, 2147483647, 9728, 2147483647, 4608, 11264}}},
        {4,
         {{-1, 1536, 4608, 2147483647, -1, 1536}, {9728, 2147483647, 1280, 2560, 6656, 13312},
          {-1, 8704, 1792, 2560, 13312, 2147483647}}},
        {10,
         {{1536, 2560, -1, 2147483647, -1, 1536}, {-1, 2560, -1, 1280, 1536, 2560},
          {6656, 7680, 3072, 2147483647, 1536, 2560}, {-1, 6656, 768, 2560, 2560, 13312},
          {-1, 9728, 2560, 2147483647, 15360, 17408}}},
        {14,
         {{2560, 6656, -1, 2147483647, -1, 1536}, {2560, 4608, -1, 1280, 1536, 2560},
          {-1, 1536, 1280, 2147483647, 1536, 2560}, {4608, 6656, -1, 2147483647, 1536, 2560},
          {7680, 2147483647, -1, 4608, -1, 2560}, {7680, 2147483647, 4608, 8704, -1, 1536},
          {7680, 8704, 8704, 2147483647, -1, 2560}, {9728, 2147483647, 8704, 2147483647, -1, 2560},
          {-1, 1536, -1, 768, 2560, 13312}, {9728, 2147483647, -1, 2560, 2560, 6656},
          {-1, 2147483647, 768, 1792, 17408, 2147483647}, {-1, 8704, 4608, 2147483647, 2560, 15360},
          {-1, 9728, 2560, 2147483647, 17408, 19456}, {9728, 2147483647, 2560, 7680, 5632, 2147483647},
          {9728, 2147483647, 7680, 9728, 2560, 2147483647}, {9728, 2147483647, 9728, 2147483647, 11264, 2147483647}}},
        {12,
         {{6656, 7680, -1, 2147483647, -1, 1536}, {1536, 4608, 1280, 2147483647, 1536, 2560},
          {6656, 7680, -1, 3072, 1536, 2560}, {7680, 9728, 4608, 8704, 1536, 2560},
          {-1, 9728, 2560, 4608, 2560, 15360}, {8704, 9728, 4608, 2147483647, 2560, 15360},
          {-1, 9728, 2560, 2147483647, 19456, 2147483647}}},
        {3,
         {{9728, 2147483647, 4608, 8704, 1536, 2560}, {-1, 2147483647, -1, 768, 17408, 2147483647},
          {9728, 2147483647, 1792, 2560, 13312, 2147483647}}},
        {8,
         {{8704, 9728, 8704, 2147483647, -1, 2560}, {6656, 9728, 768, 2560, 2560, 13312},
          {-1, 2560, -1, 1792, 13312, 17408}, {9728, 2147483647, 9728, 2147483647, 2560, 4608}}},
        {2,
         {{2560, 2147483647, -1, 1792, 13312, 17408}}}
    };

    static std::map<int, std::vector<std::vector<int>>> g_allgather91093TwoRankINT8M0Map = {
        {128,
         {{-1, 4608, -1, 2147483647, -1, 2560}, {9728, 2147483647, 8704, 2147483647, -1, 1536},
          {7680, 2147483647, 7680, 2147483647, 1536, 2560}, {-1, 2147483647, -1, 4608, 2560, 2147483647},
          {-1, 2147483647, 4608, 2147483647, 2560, 19456}, {5632, 2147483647, 4608, 2147483647, 19456, 2147483647}}},
        {256,
         {{4608, 2147483647, -1, 8704, -1, 1536}, {4608, 9728, 8704, 2147483647, -1, 1536},
          {4608, 7680, -1, 2147483647, 1536, 2560}, {7680, 2147483647, -1, 7680, 1536, 2560},
          {-1, 5632, 4608, 2147483647, 19456, 2147483647}}}
    };

    void AllGatherNPU91093EightRankFP16Tiling(CoCTilingData &cocTilingData)
    {
        std::map<int*, TilingValue> TilingParamMap = {
            {&cocTilingData.m0,
             {ALLGATHER_91093_EIGHT_RANK_FP16_M0_DEFAULT,
              g_allgather91093EightRankFP16M0Map}},
            {&cocTilingData.ubMoveNum,
             {ALLGATHER_91093_EIGHT_RANK_FP16_UBMOVENUM_DEFAULT,
              g_allgather91093EightRankFP16UbmovenumMap}},
            {&cocTilingData.pValue,
             {ALLGATHER_91093_EIGHT_RANK_FP16_PVALUE_DEFAULT,
              g_allgather91093EightRankFP16PvalueMap}},
            {&cocTilingData.commDataSplit,
             {ALLGATHER_91093_EIGHT_RANK_FP16_COMMDATASPLIT_DEFAULT,
              g_allgather91093EightRankFP16CommdatasplitMap}},
            {&cocTilingData.swizzlDirect, {SWIZZLE_DIRECT_ONE}},
            {&cocTilingData.swizzlCount, {DEFAULT_SWIZZLE_COUNT}},
            {&cocTilingData.commDirect, {COMM_NPU_DIRECT}},
            {&cocTilingData.commNpuSplit, {COMMNPUSPLIT_ONE}},
        };
        SetTilingParam(cocTilingData, TilingParamMap);

        cocTilingData.lenPerLoop = cocTilingData.ubMoveNum * cocTilingData.commDataSplit;
        DealTilingParamByBuffSize(cocTilingData);
    }

    void AllGatherNPU91093SixteenRankFP16Tiling(CoCTilingData &cocTilingData)
    {
        std::map<int*, TilingValue> TilingParamMap = {
            {&cocTilingData.m0,
             {ALLGATHER_91093_SIXTEEN_RANK_FP16_M0_DEFAULT,
              g_allgather91093SixteenRankFP16M0Map}},
            {&cocTilingData.pValue,
             {ALLGATHER_91093_SIXTEEN_RANK_FP16_PVALUE_DEFAULT,
              g_allgather91093SixteenRankFP16PvalueMap}},
            {&cocTilingData.commDirect,
             {ALLGATHER_91093_SIXTEEN_RANK_FP16_COMMDIRECT_DEFAULT,
              g_allgather91093SixteenRankFP16CommdirectMap}},
            {&cocTilingData.commDataSplit,
             {ALLGATHER_91093_SIXTEEN_RANK_FP16_COMMDATASPLIT_DEFAULT,
              g_allgather91093SixteenRankFP16CommdatasplitMap}},
            {&cocTilingData.ubMoveNum,
             {ALLGATHER_91093_SIXTEEN_RANK_FP16_UBMOVENUM_DEFAULT,
              g_allgather91093SixteenRankFP16UbmovenumMap}},
            {&cocTilingData.swizzlDirect, {SWIZZLE_DIRECT_ONE}},
            {&cocTilingData.swizzlCount, {SWIZZLE_COUNT_FOUR}}
        };
        SetTilingParam(cocTilingData, TilingParamMap);

        cocTilingData.commNpuSplit =
                cocTilingData.commDataSplit == COMMDATASPLIT_ONE ? cocTilingData.rankSize : COMMNPUSPLIT_ONE;
        cocTilingData.lenPerLoop = cocTilingData.ubMoveNum * cocTilingData.commDataSplit;
        DealTilingParamByBuffSize(cocTilingData);
    }

    void AllGatherNPU91093TwoRankFP16Tiling(CoCTilingData &cocTilingData)
    {
        std::map<int*, TilingValue> TilingParamMap = {
            {&cocTilingData.commDataSplit,
             {ALLGATHER_91093_TWO_RANK_FP16_COMMDATASPLIT_DEFAULT,
              g_allgather91093TwoRankFP16CommdatasplitMap}},
            {&cocTilingData.m0,
             {ALLGATHER_91093_TWO_RANK_FP16_M0_DEFAULT,
              g_allgather91093TwoRankFP16M0Map}},
            {&cocTilingData.ubMoveNum,
             {ALLGATHER_91093_TWO_RANK_FP16_UBMOVENUM_DEFAULT,
              g_allgather91093TwoRankFP16UbmovenumMap}},
            {&cocTilingData.pValue,
             {ALLGATHER_91093_TWO_RANK_FP16_PVALUE_DEFAULT,
              g_allgather91093TwoRankFP16PvalueMap}},
            {&cocTilingData.swizzlDirect, {SWIZZLE_DIRECT_ONE}},
            {&cocTilingData.swizzlCount, {DEFAULT_SWIZZLE_COUNT}},
            {&cocTilingData.commDirect, {COMM_DATA_DIRECT}},
            {&cocTilingData.commNpuSplit, {COMMNPUSPLIT_ONE}}
        };
        SetTilingParam(cocTilingData, TilingParamMap);

        cocTilingData.lenPerLoop = cocTilingData.ubMoveNum * cocTilingData.commDataSplit;
        DealTilingParamByBuffSize(cocTilingData);
    }

    void AllGatherNPU91093TwoRankINT8Tiling(CoCTilingData &cocTilingData)
    {
        std::map<int*, TilingValue> TilingParamMap = {
            {&cocTilingData.commDataSplit,
             {ALLGATHER_91093_TWO_RANK_INT8_COMMDATASPLIT_DEFAULT,
              g_allgather91093TwoRankINT8CommdatasplitMap}},
            {&cocTilingData.ubMoveNum,
             {ALLGATHER_91093_TWO_RANK_INT8_UBMOVENUM_DEFAULT,
              g_allgather91093TwoRankINT8UbmovenumMap}},
            {&cocTilingData.pValue,
             {ALLGATHER_91093_TWO_RANK_INT8_PVALUE_DEFAULT,
              g_allgather91093TwoRankINT8PvalueMap}},
            {&cocTilingData.m0,
             {ALLGATHER_91093_TWO_RANK_INT8_M0_DEFAULT,
              g_allgather91093TwoRankINT8M0Map}},
            {&cocTilingData.swizzlDirect, {SWIZZLE_DIRECT_ONE}},
            {&cocTilingData.swizzlCount, {DEFAULT_SWIZZLE_COUNT}},
            {&cocTilingData.commDirect, {COMM_DATA_DIRECT}},
            {&cocTilingData.commNpuSplit, {COMMNPUSPLIT_ONE}},
        };
        SetTilingParam(cocTilingData, TilingParamMap);

        cocTilingData.lenPerLoop = cocTilingData.ubMoveNum * cocTilingData.commDataSplit;
        DealTilingParamByBuffSize(cocTilingData);
    }
}